package com.amumu.drama.common.constant;

import com.google.common.collect.Maps;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;

/**
 * @author sunzhuang
 * @date 2024/5/14 13:56
 * @slogan 天下风云出我辈, 一入代码岁月催
 * @desc 积分奖励到账状态
 */
@Getter
public enum IntegrationRewardStatusEnum {
    /**
     * 积分奖励到账状态
     */
    WAIT(0, "待到账"),
    SUCCESS(1, "生效"),
    FAIL(2, "无效")
    ;

    private Integer code;

    private String desc;

    IntegrationRewardStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private static final Map<Integer, IntegrationRewardStatusEnum> UNINDEX = Maps.uniqueIndex(Arrays.asList(values()), IntegrationRewardStatusEnum::getCode);

    public static IntegrationRewardStatusEnum getByCode(Integer code) {
        return UNINDEX.get(code);
    }

}
